﻿
@model Model.DictManage.E_tb_TypeDict
@{
    ViewBag.Title = "TypeDictList";
}

<!DOCTYPE html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title>类别字典</title>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/themes/default/easyui.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/themes/icon.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/demo.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/uploader/uploadify.css")' />
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/Validform/style.css")'  />
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/Validform/style.css")'  />
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Content/XINDECSS/MainStyle.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Content/XINDECSS/DishTtyeTree.css")'/>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-1.8.2.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-easyui/jquery.easyui.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-easyui/locale/easyui-lang-zh_CN.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/uploader/jquery.uploadify.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/uploader/swfobject.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/MicrosoftAjax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/MicrosoftMvcAjax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/Validform/Validform_v5.3.2_min.js")'></script>
    @*<script src="../../Scripts/jquery-1.8.2.js" type="text/javascript"></script>*@
    <script type="text/javascript">
        $(document).ready(function () {
            $('#EditForms').dialog('close');
        });
    </script>
    
    <!--编辑-->
    <script type="text/javascript">
        //添加
        function Add(ParentID) {
            $("#HidEditType").val("Add");
            $("#HidTypeID").val("");
            $("#HidParentID").val(ParentID);
            $("#txt_TypeName").val("");
            $("#txt_Directions").val("");
            $('#EditForms').dialog('open');
        }

        //弹出编辑页
        function Edit(InfoID) {
            $.get("/TypeDict/TypeDictEdit?EditType=Edit&InfoID=" + InfoID, function (NewsInfo) {
                $("#HidEditType").val(NewsInfo.EditType);
                $("#HidTypeID").val(NewsInfo.TypeID);
                $("#HidParentID").val(NewsInfo.ParentID);
                $("#HidTypeLevel").val(NewsInfo.TypeLevel);
                $("#HidSubjectID").val(NewsInfo.SubjectID);
                $("#txt_TypeName").val(NewsInfo.TypeName);
                $("#txt_Directions").val(NewsInfo.Directions);
                $('#EditForms').dialog('open');
            });
        }

        //删除
        function Delete(InfoID) {
            if (confirm("确定要删除数据吗？")) {
                $.getJSON("/TypeDict/Delete/" + InfoID,
                function (data) {
                    if (data == "删除成功！") {
                        alert(data);
                        window.location.reload();
                    }
                    else {
                        alert("删除失败，请检查该类别下是否存在子类！");
                    }
                });
            }
        }

        //关闭弹出层
        function Close() {
            $('#EditForms').dialog('close');
        }

        //保存提示
        function handle(e) {
            if (e == "1") {
                alert("保存成功！");
                $('#EditForms').window('close');
                window.location.reload();

            } else {
                alert("保存失败！");
            }
        }
        function failed(e) {
            alert("保存失败！");
        }
    </script>

        <!--树形菜品分类-->
    <script type="text/javascript">
        function Fid(id) { return document.getElementById(id); }
        function Ftag(name) { return document.getElementsByTagName(name); }

        function rowView(id) {
            var oRow = Fid("SubItem" + id);
            if (oRow) {
                var oIcon = Fid("Icon" + id);
                if (oRow.style.display != "block") {
                    oRow.style.display = "block";
                    if (oIcon) {
                        oIcon.src = "/Content/images/Tree/folder3.gif";
                    }
                }
                else {
                    oRow.style.display = "none";
                    if (oIcon) {
                        oIcon.src = "/Content/images/Tree/folder4.gif";
                    }
                }
            }
        }
    </script>
</head>
<body>
    <!--标题-->
    <table cellpadding="0" cellspacing="0" width="100%" class="HeadTitle">
        <tr>
            <td>当前位置：类别字典管理<img style="text-align:center;vertical-align:middle;height:10px" src='@Url.Content("~/Content/Images/位置.png")' />类别列表 </td>
        </tr>
    </table>

    <!--数据列表-->
    <div class="divList" style="width:490px;">
        <table cellpadding="0" cellspacing="0" width="100%" class="WhereTable">
            <tr>
                <td align="right">
                    <a href="javascript:void(0)" onclick="Add(0)"><img src="/Content/Images/xinzeng.png" height="20px" /></a>
                </td>
            </tr>
        </table>
        <div class="Main" style="width:480px; margin-left:10px;">
            <div class="Main_Title">
                <ul>
                    <li class="WidthID">类别ID</li>
                    <li class="WidthName">类别名称</li>
                    <li class="WidthOperate">操作</li>
                </ul>
            </div>
            <div class="Main_content">
                @Html.Raw(ViewData["TypeHtml"])
            </div>
            <div style=" clear:both;"></div>
        </div>
        
    </div>

    <!--编辑页-->
   <div id="EditForms" class="easyui-dialog" title="类别信息" data-options="iconCls:'icon-save'" style="width:300px;height:180px;">
        @using (Ajax.BeginForm("Save", "TypeDict", new AjaxOptions { HttpMethod = "Post", OnSuccess = "handle", OnFailure = "failed" }, new { @id = "frmUpdate" }))
        {
            @Html.HiddenFor(m => m.EditType, new { @id = "HidEditType" })
            @Html.HiddenFor(m => m.TypeID, new { @id = "HidTypeID" })
            @Html.HiddenFor(m => m.SubjectID, new { @id = "HidSubjectID" })
            @Html.HiddenFor(m => m.ParentID, new { @id = "HidParentID" })
            @Html.HiddenFor(m => m.TypeLevel, new { @id = "HidTypeLevel" })
            <table border="0" cellpadding="0" cellspacing="0" width="98%" class="DialogTable">
                <tr>
                    <td width="70px" align="right">类别名称：</td>
                    <td align="left" style="width:260px;">@Html.TextBoxFor(m => m.TypeName, new { @style = "width:99%;", @id = "txt_TypeName" })</td>
                </tr>
                <tr>
                    <td width="70px" align="right">类别描述：</td>
                    <td align="left">@Html.TextAreaFor(m => m.Directions, new { @style = "width:99%;height:50px;", @id = "txt_Directions" })</td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <a href="javascript:void(0)" onclick="$('#frmUpdate').submit()"><img src="~/Content/Images/baocun.png" height="20px" /></a>
                        <a href="javascript:void(0)" onclick="Close()"><img src="~/Content/Images/quxiao.png" height="20px" /></a>
                    </td>
                </tr>
            </table>
        }
   </div>

</body>
